package cn.com.xuhx.testMapper;

import cn.com.xuhx.mapper.UserMapper;
import cn.com.xuhx.pojo.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;

/**
 * 修改测试
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class UpdateTest {

    @Autowired
    private UserMapper userMapper;

    /**
     * 根据ID修改
     */
    @Test
    public void testUpdate(){
        //UPDATE T_USERS SET name=?, age=?, address=?, tel=?, sfzh=?, bornday=? WHERE id=?
        User user = new User(11L, "风晴雪", 15, "幽都", "18276488333", "320682199101011224", new Date());
        int result = userMapper.updateById(user);
        System.out.println("变动数：" + result);
    }
}
